package com.j180.springdatajpa_demo.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;

import javax.persistence.*;
import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "t_user") //指定表明
public class UserBean implements Serializable {
    //指定该属性为主键列
    @Id
    //只能mysql使用，作用就是使用自动增长
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    //跟数据库中的类名对应，如果没有则使用属性名来名称表中的列名
    @Column(name = "uid")
    private Integer id;
     @Column(name="uname")
    private String name;
     @Column(name="ugender",length = 3,nullable = false)
    private String gender;
    @Column(name="uage")
    private int age;

    public UserBean(String name, String gender) {
        this.name = name;
        this.gender = gender;
    }
}
